<template>
  <!-- Form -->
  <!-- <el-button text @click="dialogFormVisible = true"
    >open a Form nested Dialog</el-button
  > -->
  <el-dialog v-model="dialogFormVisible" title="新建商品">
    <el-form :model="form">
      <el-form-item label="商品名称" :label-width="formLabelWidth">
        <el-input v-model="form.name" autocomplete="off" />
      </el-form-item>
      <el-form-item label="商品价格" :label-width="formLabelWidth">
        <el-input v-model="form.name" autocomplete="off" />
      </el-form-item>
      <el-form-item label="规格类目" :label-width="formLabelWidth">
        <el-input v-model="form.name" autocomplete="off" />
      </el-form-item>
      <el-form-item label="商品图片" :label-width="formLabelWidth">
        <el-input v-model="form.name" autocomplete="off" />
      </el-form-item>
      <el-form-item label="商品卖点" :label-width="formLabelWidth">
        <el-input v-model="form.name" autocomplete="off" />
      </el-form-item>
      <el-form-item label="商品描述" :label-width="formLabelWidth">
        <el-input v-model="form.name" autocomplete="off" />
      </el-form-item>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false"
          >确认</el-button
        >
      </span>
    </template>
  </el-dialog>
</template>

<script >
import { reactive, toRefs, ref } from "vue";

export default {
  setup() {
    const dialogFormVisible = ref(false);
    const formLabelWidth = "140px";

    const form = reactive({
      name: "",
      region: "",
      date1: "",
      date2: "",
      delivery: false,
      type: [],
      resource: "",
      desc: "",
    });

    function showModal(){
        dialogFormVisible.value = true;
    }
    return {
      form,
      //onSubmit,
      //show,
      showModal,
      dialogFormVisible,
    };
  },
};
</script>

<style>
.el-button--text {
  margin-right: 15px;
}
.el-select {
  width: 300px;
}
.el-input {
  width: 300px;
}
.dialog-footer button:first-child {
  margin-right: 10px;
}
</style>